<template>
	<!-- 小程序引流关注公众号 -->
	<view class="fixed-top border shadow" v-if="gzhShow">
		<official-account @load="bindload" @error="binderror"></official-account>
		<view class="position-absolute top-0 right-0 p-1" v-if="gzhClose" @click="gzhShow = false"><u-icon name="close" color="#CF1526" size="23"></u-icon></view>
	</view>
</template>

<script>
import { bulletBox } from '@/api/common.js';
export default {
	data() {
		return {
			gzhShow: false,
			gzhClose: false
		};
	},
	created() {
		this.getInfo();
	},
	methods: {
		// 关注公众号组件加载成功
		bindload(e) {
			if (e.detail.status == 0) {
				this.gzhShow = true;
				this.gzhClose = true;
			}
		},
		// 关注公众号组件加载成功
		binderror(e) {
			if (e) {
				this.gzhShow = false;
			}
		},
		getInfo() {
			bulletBox().then(res => {
				if (res.code == 0) {
					this.gzhShow = res.status == 1 ? true : false;
				}
			});
		}
	}
};
</script>

<style></style>
